<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 16:11
 */
namespace vendor;

use vendor\user\user;
use vendor\user\VIP1user;
use vendor\user\VIP2user;
use vendor\user\VIP3user;

require 'user\user.php';
require 'user\VIP1user.php';
require 'user\VIP2user.php';
require 'user\VIP3user.php';

print 'aaa';
class manager
{
    private $arr =[];
    //打开网站
    public function opensite()
    {
        $this->arr[]=$this->createuser(0);
        $this->arr[]=$this->createuser(0);
        $this->arr[]=$this->createuser(0);
        $this->arr[]=$this->createuser(1);
        $this->arr[]=$this->createuser(2);
        $this->arr[]=$this->createuser(3);
    }
    private function createuser($level)
    {
        $user=null;
        switch ($level){
            case 0:
                $user = new user();
                break;
            case 1:
                $user = new VIP1user();
                break;
            case 2:
                $user = new VIP2user();
                break;
            case 3:
                $user = new VIP3user();
                break;
        }
        $this->showOnlineNum();
        $user->level();
//        $user->postmessage();
//        $user->delmessage();
//        $user->onti();
        return $user;
    }
    //创建用户
//    public function createuser()
//    {
//        $user1 = new user();
////        $user1->register();
////        echo '<br />';
////        $user1->login();
////        echo '<br />';
////        $user1->updatepwd();
////        echo '<br />';
//        $user1->level();
//        echo '<br />';
//        $this->showOnlineNum();
//        return $user1;
//    }
//    public function createvip1()
//    {
//        $vipuser1 = new VIP1user();
//        $vipuser1->level();
//        echo '<br />';
//        $vipuser1->postmessage();
//        echo '<br />';
//        $this->showOnlineNum();
//        return $vipuser1;
//    }
//    public function createvip2()
//    {
//        $vipuser2 = new VIP2user();
//        $vipuser2->level();
//        echo '<br />';
//        $vipuser2->postmessage();
//        echo '<br />';
//        $vipuser2->delmessage();
//        echo '<br />';
//        $this->showOnlineNum();
//        return $vipuser2;
//    }
//    public function createvip3()
//    {
//        $vipuser3 = new VIP3user();
//        $vipuser3->level();
//        echo '<br />';
//        $vipuser3->postmessage();
//        echo '<br />';
//        $vipuser3->delmessage();
//        echo '<br />';
//        $vipuser3->onti();
//        echo '<br />';
//        $this->showOnlineNum();
//        return $vipuser3;
//    }
    //在线人数
    private function showOnlineNum()
    {
        echo '在线人数：'.user::onlinenum().'<br />';
    }
    //关闭网站
    public function closesite()
    {
        echo '<br />关闭网站<br />';
    }
    //清除对象
    public function __destruct()
    {
        echo '<br />清除对象<br />';
    }
}
$a = new manager();
$a->opensite();
$a->closesite();